<?php
include "../header.inc";

if (isset($_POST["password1"])) {
	$p1 = $_POST["password1"];
	$p2 = $_POST["password2"];
	if (trim($p1)=="") die("You cannot set an empty password");
	if ($p1 <> $p2) echo "<span style='color:red'>The two password are different. Please try again.</span><br/>";
	else {
		include "../DataBase.inc";
		$p = md5($p1);
		DataBase::update("staff",array("username"=>$_SESSION["user"]),array("password"=>$p));
		die("Password successfully changed.");
	}
}
?>
Change your password:<br/>
<form name='change_password' method='post'>
Enter your new password: <input type='password' name='password1' size=30/><br/>
Re-enter the password: <input type='password' name='password2' size=30/><br/>
<button type='submit'>Change my password</button>
</form>
<?php include "../footer.inc";?>
